<?php
/**
 * 产品
 */
namespace app\usercp\controller;

use app\usercp\exception\UsercpException;
use think\Request;

class SiteOperate extends Usercp
{
    public function initialize() {
        parent::initialize();
        $this->service = model('site/SiteOperate', 'service');
    }
    /**
     * [site_renew_record description]
     * @return [type] [description]
     */
    public function site_renew_record(Request $request){
        $maps = [];
        $maps['site_id'] = $request->get('site_id','');
        $relations = $request->get('relations',[]);
        $attrs = $request->get('attrs',['fee_log_info','custom_info','action_text','number_text']);
        $result = $this->service->lists($maps,'create_time desc',$this->page,$this->limit,true,$relations,$attrs);
        if ($result->isEmpty()){
            return $this->result('',0,'暂无数据');
        }
        foreach ($result as $key => $list) {
            $result[$key]['custom_name'] = $list->custom_info->username;
            $result[$key]['cost'] = $list->fee_log_info->money;
        }
        return $this->result($result,200);
    }
}